<script>


 
/** Function to display a Calendar based on javascript. **/
function calendar() {
  // Get the current date parameters.
  var date = new Date();
  var day = date.getDate();
  var month = date.getMonth();
  var year = date.getFullYear();
  
  var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
  var monthDays = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
  var weekDay = new Array('Su','Mo','Tu','We','Th','Fr','Sa');
  var days_in_this_month = monthDays[month];

  // Create the basic Calendar structure.
  var calendar_html = '<table class="calendarTable">';
  calendar_html += '<tr><td class="monthHead" colspan="7">' + months[month] + ' ' + year + '</td></tr>';
  calendar_html += '<tr>';
  var first_week_day = new Date(year, month, 1).getDay();
  for(week_day= 0; week_day < 7; week_day++) {
    calendar_html += '<td class="weekDay">' + weekDay[week_day] + '</td>';
  }
  calendar_html += '</tr><tr>';

  // Fill the first week of the month with the appropriate number of blanks.
  for(week_day = 0; week_day < first_week_day; week_day++) {
    calendar_html += '<td> </td>';
  }
  week_day = first_week_day;
  for(day_counter = 1; day_counter <= days_in_this_month; day_counter++) {
    week_day %= 7;
    if(week_day == 0)
      calendar_html += '</tr><tr>';
    // Do something different for the current day.
    if(day == day_counter) {
      calendar_html += '<td class="currentDay">' + day_counter + '</td>';
    } else {
      calendar_html += '<td class="monthDay"> ' + day_counter + ' </td>';
 }
    week_day++;
  }
  calendar_html += '</tr>';
  calendar_html += '</table>';
  // Display the calendar.
  document.write(calendar_html);
}

      google.load('visualization', '1', {packages:['table']});
      google.setOnLoadCallback(drawTable);
      function drawTable() {
        var data = new google.visualization.DataTable();
      data.addColumn('string', 'Case ID');
        data.addColumn('string', 'For');
		  data.addColumn('string', 'Under');
		  data.addColumn('string', 'Assigned');
        data.addColumn('boolean', 'Status');
      <?php foreach ($table as $tables){?>
        data.addRows([
          ['<?php echo $tables->case_no;?>', '<?php if($tables->status_id<4)echo "Diagnosis"; else echo "Repair"?>','<?php echo"Warranty";?>',
		  '<?php echo $tables->username;?> '
		  ,<?php $data=$tables->status_id; if($data==3 OR $data==10){echo"true";} else {echo "false";}?>],
         
        ]);
<?php } ?>
 <?php foreach ($table1 as $tables){?>
        data.addRows([
          ['<?php echo $tables->case_no;?>', '<?php if($tables->status_id<4)echo "Diagnosis"; 
		  else if($tables->status_id==4 OR $tables->status_id==5)
		  { echo "Waiting for part"; }
		  else
		  echo "Repair"?>','<?php echo "Non-Warranty";?>',
		  '<?php echo $tables->username;?> '
		  ,<?php $data=$tables->status_id; if($data==3 OR $data==11){echo"true";} else {echo "false";}?>],
         
        ]);
<?php } ?>

        var table = new google.visualization.Table(document.getElementById('table_div'));
        table.draw(data, {showRowNumber: true});
      }
    </script>
 <script type="text/javascript">
      google.load('visualization', '1', {packages: ['corechart']});
    </script>
    <script type="text/javascript">
      function drawVisualization() {
        // Some raw data (not necessarily accurate)
        var data = google.visualization.arrayToDataTable([
          ['Month', 'Total case id', 'Warranty',  'Non Warranty'],
          ['<?php echo date('M');?>',  <?php echo $no_case+$no_nonwarrantycase;?>, <?php echo $no_case;?>,<?php echo $no_nonwarrantycase;?>]
        ]);

        var options = {
          title : 'No. Of Case ID',
          vAxis: {title: "Case ID"},
          hAxis: {title: "Month"},
          seriesType: "bars",
          series: {10: {type: "line"}}
        };

        var chart = new google.visualization.ComboChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
      google.setOnLoadCallback(drawVisualization)
	  </script>
	 
  


	 
   <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Type', ' per Day'],
          ['Active',    <?php echo $active_engineer;?>],
          ['Not active',      <?php echo $engineer-$active_engineer;?>]
          
        ]);

        var options = {
          title: 'Total No. Active Engineer'
        };

        var chart = new google.visualization.PieChart(document.getElementById('pie_chart'));
        chart.draw(data, options);
      }
    </script>


<div class="row-fluid" id="main1">
<div class="span12 pad_all">
<div id="padd" class="span2">
	<div><img src="<?php echo base_url()?>/user_image/admin/<?php echo $image->name;?>"  width="175" height="200" alt="edit" ></div>
			     <a  href="<?php echo site_url()?>/admin/admin_dashboard/update_profile" >change</a><br><br>

<br/>

<br>

</div>

<div class="span10 " >
 
				  <a href="<?php echo site_url()?>/admin/admin_dashboard/update_profile" class="dashboard-module">
                	<img src="<?php echo base_url()?>/assets/images/Crystal_Clear_user.gif"  width="40" height="45" alt="edit" />
                	<span>My profile</span>
                </a>
				<a href="<?php echo site_url('/admin/admin')?>"class="dashboard-module">
                	<img src="<?php echo base_url()?>/assets/images/user1.png"  width="35" height="45" alt="edit" />
                	<span>New Service ID</span>
                </a>
					<a href="<?php echo site_url('/admin/engineer/create_engineer')?>"class="dashboard-module">
                	<img src="<?php echo base_url()?>/assets/images/icon_users.png"  width="35" height="45" alt="edit" />
                	<span>New Engineer</span>
                </a>
            	<a><a href="<?php echo site_url('/admin/diagnosis/dispatch_diagnosis')?>" class='dashboard-module'>
                	<img src="<?php echo base_url()?>/assets/images/report.png"  width="35" height="45" alt="edit" />
                	<span> Diagnosis Report</span>
                </a>
				
				<a href="<?php echo site_url('/admin/docket/new_received')?>" class="dashboard-module">
                	<img src="<?php echo base_url()?>/assets/images/icon_reports.png"  width="35" height="45" alt="edit" />
                	<span> New Dispatch Received</span>
                </a>
                 
                <a href="<?php echo site_url()?>/admin/repair/view_allrepair" class="dashboard-module">
                	<img src="<?php echo base_url()?>/assets/images/Crystal_Clear_settings.gif"  width="35" height="45" alt="edit" />
                	<span> ALL Repair</span>
                </a>
                <a href="<?php echo site_url('/admin/repair/view_completed_repair')?>"class="dashboard-module">
                	<img src="<?php echo base_url()?>/assets/images/icon_edit.png" width="35" height="45" alt="edit" />
                	<span> Repair Report</span>
                </a>
                   
            <a href="<?php echo site_url('/admin/defective/view_alldefective')?>" class="dashboard-module">
                	<img src="<?php echo base_url()?>/assets/images/Crystal_Clear_stats.gif"  width="35" height="45" alt="edit" />
                	<span> Defective Part</span>
                </a>

                
               <a href="<?php echo site_url('/admin/repair/view_reassigned')?>"class="dashboard-module">
                	<img src="<?php echo base_url()?>/assets/images/Crystal_Clear_calendar.gif" tppabs="http://www.xooom.pl/work/magicadmin/images/Crystal_Clear_calendar.gif" width="35" height="45" alt="edit" />
                	<span> ALL Reassigned Case</span>
                </a>
                   <a href="<?php echo site_url('admin/order/view_order')?>"class="dashboard-module">
                	<img src="<?php echo base_url()?>/assets/images/icon_media.png"  width="35" height="45" alt="edit" />
                	<span>ALL Order</span>
                </a>
                
                  <a href="<?php echo site_url('admin/order/order_received')?>" class="dashboard-module">
                	<img src="<?php echo base_url()?>/assets/images/receive.png"  width="35" height="45" alt="edit" />
                	<span>Received Order</span>
                </a>
				<a href="<?php echo site_url('admin/chk_status/chk_case')?>" class="dashboard-module">
                	<img src="<?php echo base_url()?>/assets/images/search1.png"  width="35" height="45" alt="edit" />
                	<span>Case Status</span>
                </a>
			
                <div style="clear: both"></div>







</br></br>
			<div class="row-fluid">
			<div class="span12" id="table_div" style=" "> </div></div>
			</br>
			<div class="row-fluid" id="main2">
			
<div class="span6" id="chart_div" style="width:48%; height:400px; "></div>
	<div class="span6" id="pie_chart"  style="width: 49%; height:400px;" ></div>
</div>

</div>

</div></div>
       

   <script type="text/javascript">
        $("[rel=tooltip]").tooltip();
        $(function() {
            $('.demo-cancel-click').click(function(){return false;});
        });
    </script> 
